<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <title>多张图片垂直居中</title>
        <style type="text/css">
            .imgWrap li{ 
                width: 219px;
                height: 219px;
                float: left;
                border: solid 1px #666;
                margin: 10px 10px 0 0;
                list-style: none;
                text-align: center;
                font-size: 0;
            }

            .imgWrap a {
                display: block;
                height: 100%;
                background: #ffa url(images/gridBg.gif) repeat center;
            }
            .imgWrap a:hover {
                background-color: green;
            }
            .imgWrap span {
                display: inline-block;/*将行内元素改变为行内块元素显示*/
                width: 1px;/*实现ＩＥ下可读效果*/
                height: 100%;/*使用元素高度和图片容器高度一样*/
                vertical-align: middle;/*垂直对齐*/
            }

            .imgWrap img {
                vertical-align: middle;
            }
        </style>
    </head>
    <body>
        <ul class="imgWrap clearfix">
            <li><a href="#" class="imgBox"><span></span><img src="images/img1.jpg" alt="" /></a></li>
            <li><a href="#" class="imgBox"><span></span><img src="images/img2.jpg" alt="" /></a></li>
            <li><a href="#" class="imgBox"><span></span><img src="images/img3.jpg" alt="" /></a></li>
            <li><a href="#" class="imgBox"><span></span><img src="images/img4.jpg" alt="" /></a></li>
        </ul>
    </body>
</html>